package com.transportationapp;


import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

/*
 * menu bar appeared while pushing the menu button
 * menu items : Help, Settings, Exit 
 * 
 */
public class menu extends Activity{
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.option_menu, menu);
		return true;
	}
	@Override
	public boolean onOptionsItemSelected(MenuItem item){
		switch(item.getItemId()){
		case R.id.item1: //Help
			Toast.makeText(this, "Help", Toast.LENGTH_SHORT).show();
			break;
			
		case R.id.item2: //Settings
			Toast.makeText(this, "Settings", Toast.LENGTH_SHORT).show();
			break;
			
		case R.id.item3: // Exit
			Intent intent = new Intent(Intent.ACTION_MAIN);
			intent.addCategory(Intent.CATEGORY_HOME);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			startActivity(intent);
		}
		return true;
	}
}
